/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.mse.camel.client.posterboard.posterboard.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import edu.mse.camel.client.posterboard.posterboard.PBDiagram;
import edu.mse.camel.client.posterboard.posterboard.Posterboard;
import edu.mse.camel.client.posterboard.posterboard.PosterboardPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Posterboard</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.mse.camel.client.posterboard.posterboard.impl.PosterboardImpl#getDiagrams <em>Diagrams</em>}</li>
 *   <li>{@link edu.mse.camel.client.posterboard.posterboard.impl.PosterboardImpl#getUmlFile <em>Uml File</em>}</li>
 *   <li>{@link edu.mse.camel.client.posterboard.posterboard.impl.PosterboardImpl#getDiagramFile <em>Diagram File</em>}</li>
 *   <li>{@link edu.mse.camel.client.posterboard.posterboard.impl.PosterboardImpl#getWhiteboardFile <em>Whiteboard File</em>}</li>
 *   <li>{@link edu.mse.camel.client.posterboard.posterboard.impl.PosterboardImpl#getSessionID <em>Session ID</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PosterboardImpl extends EObjectImpl implements Posterboard {
	/**
	 * The cached value of the '{@link #getDiagrams() <em>Diagrams</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiagrams()
	 * @generated
	 * @ordered
	 */
	protected EList<PBDiagram> diagrams;

	/**
	 * The default value of the '{@link #getUmlFile() <em>Uml File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUmlFile()
	 * @generated
	 * @ordered
	 */
	protected static final String UML_FILE_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getUmlFile() <em>Uml File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUmlFile()
	 * @generated
	 * @ordered
	 */
	protected String umlFile = UML_FILE_EDEFAULT;
	/**
	 * The default value of the '{@link #getDiagramFile() <em>Diagram File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiagramFile()
	 * @generated
	 * @ordered
	 */
	protected static final String DIAGRAM_FILE_EDEFAULT = null;
	/**
	 * The cached value of the '{@link #getDiagramFile() <em>Diagram File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDiagramFile()
	 * @generated
	 * @ordered
	 */
	protected String diagramFile = DIAGRAM_FILE_EDEFAULT;
	/**
	 * The default value of the '{@link #getWhiteboardFile() <em>Whiteboard File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWhiteboardFile()
	 * @generated
	 * @ordered
	 */
	protected static final String WHITEBOARD_FILE_EDEFAULT = "";
	/**
	 * The cached value of the '{@link #getWhiteboardFile() <em>Whiteboard File</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getWhiteboardFile()
	 * @generated
	 * @ordered
	 */
	protected String whiteboardFile = WHITEBOARD_FILE_EDEFAULT;

	/**
	 * The default value of the '{@link #getSessionID() <em>Session ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSessionID()
	 * @generated
	 * @ordered
	 */
	protected static final int SESSION_ID_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getSessionID() <em>Session ID</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSessionID()
	 * @generated
	 * @ordered
	 */
	protected int sessionID = SESSION_ID_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PosterboardImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return PosterboardPackage.Literals.POSTERBOARD;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PBDiagram> getDiagrams() {
		if (diagrams == null) {
			diagrams = new EObjectContainmentEList<PBDiagram>(PBDiagram.class, this, PosterboardPackage.POSTERBOARD__DIAGRAMS);
		}
		return diagrams;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getUmlFile() {
		return umlFile;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUmlFile(String newUmlFile) {
		String oldUmlFile = umlFile;
		umlFile = newUmlFile;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PosterboardPackage.POSTERBOARD__UML_FILE, oldUmlFile, umlFile));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDiagramFile() {
		return diagramFile;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDiagramFile(String newDiagramFile) {
		String oldDiagramFile = diagramFile;
		diagramFile = newDiagramFile;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PosterboardPackage.POSTERBOARD__DIAGRAM_FILE, oldDiagramFile, diagramFile));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getWhiteboardFile() {
		return whiteboardFile;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setWhiteboardFile(String newWhiteboardFile) {
		String oldWhiteboardFile = whiteboardFile;
		whiteboardFile = newWhiteboardFile;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PosterboardPackage.POSTERBOARD__WHITEBOARD_FILE, oldWhiteboardFile, whiteboardFile));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getSessionID() {
		return sessionID;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSessionID(int newSessionID) {
		int oldSessionID = sessionID;
		sessionID = newSessionID;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, PosterboardPackage.POSTERBOARD__SESSION_ID, oldSessionID, sessionID));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case PosterboardPackage.POSTERBOARD__DIAGRAMS:
				return ((InternalEList<?>)getDiagrams()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case PosterboardPackage.POSTERBOARD__DIAGRAMS:
				return getDiagrams();
			case PosterboardPackage.POSTERBOARD__UML_FILE:
				return getUmlFile();
			case PosterboardPackage.POSTERBOARD__DIAGRAM_FILE:
				return getDiagramFile();
			case PosterboardPackage.POSTERBOARD__WHITEBOARD_FILE:
				return getWhiteboardFile();
			case PosterboardPackage.POSTERBOARD__SESSION_ID:
				return new Integer(getSessionID());
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case PosterboardPackage.POSTERBOARD__DIAGRAMS:
				getDiagrams().clear();
				getDiagrams().addAll((Collection<? extends PBDiagram>)newValue);
				return;
			case PosterboardPackage.POSTERBOARD__UML_FILE:
				setUmlFile((String)newValue);
				return;
			case PosterboardPackage.POSTERBOARD__DIAGRAM_FILE:
				setDiagramFile((String)newValue);
				return;
			case PosterboardPackage.POSTERBOARD__WHITEBOARD_FILE:
				setWhiteboardFile((String)newValue);
				return;
			case PosterboardPackage.POSTERBOARD__SESSION_ID:
				setSessionID(((Integer)newValue).intValue());
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case PosterboardPackage.POSTERBOARD__DIAGRAMS:
				getDiagrams().clear();
				return;
			case PosterboardPackage.POSTERBOARD__UML_FILE:
				setUmlFile(UML_FILE_EDEFAULT);
				return;
			case PosterboardPackage.POSTERBOARD__DIAGRAM_FILE:
				setDiagramFile(DIAGRAM_FILE_EDEFAULT);
				return;
			case PosterboardPackage.POSTERBOARD__WHITEBOARD_FILE:
				setWhiteboardFile(WHITEBOARD_FILE_EDEFAULT);
				return;
			case PosterboardPackage.POSTERBOARD__SESSION_ID:
				setSessionID(SESSION_ID_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case PosterboardPackage.POSTERBOARD__DIAGRAMS:
				return diagrams != null && !diagrams.isEmpty();
			case PosterboardPackage.POSTERBOARD__UML_FILE:
				return UML_FILE_EDEFAULT == null ? umlFile != null : !UML_FILE_EDEFAULT.equals(umlFile);
			case PosterboardPackage.POSTERBOARD__DIAGRAM_FILE:
				return DIAGRAM_FILE_EDEFAULT == null ? diagramFile != null : !DIAGRAM_FILE_EDEFAULT.equals(diagramFile);
			case PosterboardPackage.POSTERBOARD__WHITEBOARD_FILE:
				return WHITEBOARD_FILE_EDEFAULT == null ? whiteboardFile != null : !WHITEBOARD_FILE_EDEFAULT.equals(whiteboardFile);
			case PosterboardPackage.POSTERBOARD__SESSION_ID:
				return sessionID != SESSION_ID_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (umlFile: ");
		result.append(umlFile);
		result.append(", diagramFile: ");
		result.append(diagramFile);
		result.append(", whiteboardFile: ");
		result.append(whiteboardFile);
		result.append(", sessionID: ");
		result.append(sessionID);
		result.append(')');
		return result.toString();
	}

} //PosterboardImpl
